﻿Imports System.Data
Imports System.Data.SqlClient

Public Class AccesoDatos


    Public Shared Function getEstadoConexion() As Boolean

        Return FuncionesDatos.getEstadoConexion()

    End Function

    Public Shared Function obtenerTransaccionLocal(ByVal transaccion As Integer) As Integer

        Dim _Store As SqlCommand = FuncionesDatos.crearStore(transaccion)

        'Consulta si la transaccion ya existe para no reimprimir 
        _Store.CommandText = "SCO_ConsultarNroTrans"

        Return FuncionesDatos.ejecutarStore(_Store)

    End Function


    Public Shared Function obtenerTransaccionEwave(ByVal transaccion As Integer) As Boolean

        Dim _Store As SqlCommand = FuncionesDatos.crearStoreEwave(transaccion)

        'Consulta si la transaccion existe
        _Store.CommandText = "SCO_ConsultaTrans"

        Return FuncionesDatos.ejecutarStoreEwave(_Store)

    End Function

    Public Shared Function validarTerminal(ByVal terminal As String) As String

        Dim _Store As SqlCommand = FuncionesDatos.crearStoreValidarTerminal(terminal)

        'Consulta si la transaccion existe
        _Store.CommandText = "SCO_validarusuario"

        Return FuncionesDatos.ejecutarStoreValidarLogin(_Store)

    End Function

    Public Shared Function validarNivelUsuario(ByVal usuario As String) As Integer

        Dim _Store As SqlCommand = FuncionesDatos.crearStorevalidarNivelUsuario(usuario)

        'Consulta si la transaccion existe
        _Store.CommandText = "sco_nivelusuario"

        Return FuncionesDatos.ejecutarStoreValidarNivelUsuario(_Store)

    End Function

    Public Shared Function getArrayItems() As ArrayList

        Return Globales.getArrayItems()

    End Function

    Public Shared Sub vaciarArrayItemTransaccion()

        Globales.vaciarArrayItemTransaccion()

    End Sub

    Public Shared Function getArrayItemNC() As ArrayList

        Return Globales.getArrayItemsNC()

    End Function

    Public Shared Sub vaciarArrayItemNC()

        Globales.vaciarArrayItemNC()

    End Sub

    Public Shared Sub setTasaSC()

        Globales.setTasaSC()

    End Sub

    Public Shared Function getImporteTotalEntradas() As Double

        Return Globales.getImporteTotalEntradas()

    End Function

    Public Shared Function getTasaSC() As Double

        Return Globales.getTasaSC()

    End Function

    Public Shared Function calcularSC() As Double

        Return Globales.calcularSC()

    End Function

    Public Shared Function getTerminalIdEwave() As String

        Return Globales.obtenerTerminalEwave()

    End Function

    Public Shared Sub setTerminalIdEwave()

        Globales.setTerminalEwave()

    End Sub

    Public Shared Sub setUsuarioActivo(ByVal usuario As String)

        Globales.setUsuarioActivo(usuario)

    End Sub

    Public Shared Function getUsuarioActivo() As String

        Return Globales.getUsuarioActivo()

    End Function

    Public Shared Function validarsumaScharge(ByVal fecha As Date, ByVal pv As Integer) As String

        Dim _Store As SqlCommand = FuncionesDatos.crearStoreValidacierreScharge(fecha, pv)

        'Consulta si la transaccion existe
        _Store.CommandText = "SCO_CONTROLSERVICECHARGE_PRUEBA"

        Return FuncionesDatos.ejecutarStoreValidacierreScharge(_Store)

    End Function


    Public Shared Function buscarTicketNC(ByVal pvOriginal As Integer, ByVal ticketOriginal As String) As Boolean

        Dim _Store As SqlCommand = FuncionesDatos.crearStoreBuscarTicketNC(pvOriginal, ticketOriginal)

        'Consulta si la transaccion existe
        _Store.CommandText = "SCO_TICKET_NC"

        Return FuncionesDatos.ejecutarStoreBuscarTicketNC(_Store)

    End Function

End Class
